<template>
  <div>
    <!--表格渲染-->
    <el-table ref="table" :data="cruddata" style="width: 100%" border>
      <el-table-column type="index" width="55" label="ID" />
      <el-table-column
        :show-overflow-tooltip="true"
        prop="uid"
        label="UID"
      />
      <el-table-column
        :show-overflow-tooltip="true"
        prop="nickName"
        label="昵称"
      />
      <el-table-column
        :show-overflow-tooltip="true"
        prop="time"
        label="时间"
      />
    </el-table>
    <!--分页组件-->
    <pagination
      :total="total"
      :page="params.page"
      :limit="params.pageSize"
      @pagination="pagination"
    />
  </div>
</template>

<script>
// import pagination from '@crud/Pagination'
import pagination from "@/components/Pagination";
import { inviteList } from "@/api/customer";
export default {
  name: "accountract",
  props: ["userId"],
  components: { pagination },
  data() {
    return {
      params: {
        page: 1,
        pageSize: 10,
      },
      cruddata: [],
      total: 0
    };
  },
  created() {
    this.getList();
  },
  methods: {
    pagination(data) {
      this.params.page = data.page;
      this.params.pageSize = data.limit;
      this.getList();
    },
    getList() {
      inviteList({
        userId: this.userId,
        page: this.params.page,
        size: this.params.pageSize,
      }).then((res) => {
        console.log(res)
        if (res.code == 0) {
          this.cruddata = res.data.records;
          this.total = +res.data.total;
        } else {
          this.$message.error(res.message);
        }
      });
    },
  },
};
</script>
